Skip to main content

🌐 Network and Connectivity Commands

πŸ“ Ping (Check Network Connectivity)​

ping <hostname_or_IP>

πŸ“Œ Tests if a host is reachable and measures latency.

Example:

ping google.com

Checks if Google’s servers are reachable and measures response time.


πŸ” Traceroute / Tracert (Trace Network Route)​

  • Windows:
    tracert <hostname_or_IP>
  • macOS/Linux:
    traceroute <hostname_or_IP>

πŸ“Œ Displays the path packets take to reach a destination.

Example:

traceroute google.com

Shows all hops taken to reach Google’s server.


🌎 NSLookup (Query DNS Records)​

nslookup <hostname_or_IP>

πŸ“Œ Fetches domain name system (DNS) records for a given hostname or IP.

Example:

nslookup google.com

Returns the IP address of Google's domain.


πŸ“‘ Dig (Get Detailed DNS Information)​

  • Query DNS records:
    dig <hostname>
  • Perform reverse lookup:
    dig -x <IP_address>

πŸ“Œ Fetches detailed DNS records or performs a reverse lookup.

Example:

dig google.com

Displays detailed DNS information for Google’s domain.


πŸ–§ Telnet (Test Port Connectivity)​

telnet <hostname_or_IP> <port>

πŸ“Œ Tests connectivity to a specific port on a remote host.

Example:

telnet google.com 80

Checks if Google's web server is accessible on port 80.


🌐 Curl (Retrieve Data from URLs)​

curl <url>

πŸ“Œ Fetches web content, tests API responses, or checks server availability.

Example:

curl -I https://google.com

Returns the HTTP headers of Google’s homepage.


πŸ“₯ Wget (Download Files from the Web)​

wget <url>

πŸ“Œ Downloads files via HTTP, HTTPS, or FTP.

Example:

wget https://example.com/file.zip

Downloads a file from the given URL.


🚦 MTR (Network Diagnostic Tool)​

mtr <hostname_or_IP>

πŸ“Œ Combines ping and traceroute for real-time network monitoring.

Example:

mtr google.com

Continuously monitors the route to Google’s server.


πŸ”Ž Nmap (Network Scanner)​

nmap <hostname_or_IP>

πŸ“Œ Scans networks to discover hosts and open ports.

Example:

nmap -p 80,443 google.com

Scans Google’s server for open web ports.


πŸ”’ SCP (Secure Copy Protocol)​

scp <file> <user>@<remote_host>:<destination_path>

πŸ“Œ Securely transfers files between local and remote systems over SSH.

Example:

scp myfile.txt user@192.168.1.10:/home/user/

_ Copies myfile.txt to a remote server. _